Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

227
Vistas
Expected value found [object, Object] Query Params

I don't get it, I sent in the right input type here:

Caller from JS code:

export interface FilterInput {
    limit?: number;
}

const filter: FilterInput = { limit: 1 };
const query = {
    query: `query { 
        companies(filter: ${filter}) {
            list {
                name
            }
        }
    }`,
};
const response = await sendQuery(query);
        

GraphQL Schema:

companies(filter: FilterInput): Companies

input FilterInput {
  limit: Int
}

Error: Expected value of type "FilterInput", found [object, Object].

When I try this out in graphiql in the browser, it works fine:

query {
    companies(filter: { limit: 6 }) {
        list {
            name
        }
    }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Using a js object in a template string directly resolves to [object Object] i.e. ${filter} resolves to precisely [object Object] hence the error.

To solve it you can use JSON.stringify(filter). Here is the string in the same format as before but with the fix:

`query { 
    companies(filter: ${JSON.stringify(filter)}) {
        list {
            name
        }
    }
}`
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda